﻿using System;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.Web.UI;
using System.Reflection;

using Developmentalmadness.Web.UI.AjaxAbstractions;

namespace Developmentalmadness.Web.UI.ExtJsControlLibrary
{
    public class ExtJsMenuCheckItem : ExtJsMenuItem
    {
        public override IList<ScriptDescriptor> GetScriptDescriptors()
        {
            IList<ScriptDescriptor> list = base.GetScriptDescriptors();

            ScriptControlDescriptorBase desc = (ScriptControlDescriptorBase)list[0];

            desc.Type = "Ext.menu.CheckItem";

            if (Checked.HasValue)
                desc.AddPropertyBase("Checked", Checked.Value);

            if (!String.IsNullOrEmpty(group))
                desc.AddPropertyBase("group", String.Format("'{0}'", group));

            if (!String.IsNullOrEmpty(groupClass))
                desc.AddPropertyBase("groupClass", String.Format("'{0}'", groupClass));

            return list;
        }

        #region Public Properties

        public Boolean? Checked { get; set; }

        public String group { get; set; }

        public String groupClass { get; set; }

        #endregion
    }
}
